home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / filutil / ygrep401.zip / YGREP.H < prev    next >
C/C++ Source or Header  |  1995-02-01  |  5KB  |  183 lines

  1. /*
  2. //    SCCS Id: "@(#)ygrep.h        (C) Yves Roumazeilles    95/02/01";
  3. //
  4. //    Version 4.01
  5. */
  6.  
  7. #ifndef    __YGREP_H__
  8. #define    __YGREP_H__    
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13.  
  14. #ifdef    WINVER
  15. #define    YGCALL    FAR PASCAL
  16. #else
  17. #define    YGCALL    
  18. #endif
  19.  
  20. WORD    YGCALL    YGrepVersion( void );
  21. BOOL    YGCALL    YGrepIsDebug( void );
  22.  
  23.  
  24. /* YGrep Search Engine Error Codes */
  25. #define AGERR_UNKNOWN_TYPE        -1
  26. #define AGERR_NO_ERROR            0
  27. #define AGERR_STATE            1
  28. #define AGERR_ALLOC_MEM            2
  29. #define AGERR_TOO_SHORT            3
  30. #define AGERR_TOO_LONG            4
  31. #define AGERR_NO_PREVIOUS        5
  32. #define AGERR_NO_PATTERN        6
  33.  
  34. #define RGERR_MUNGED_AUTO        20
  35. #define RGERR_MISS_BRACKET        25
  36. #define RGERR_EMPTY_ENCL        26
  37. #define RGERR_ILLEGAL_ENCL        27
  38. #define RGERR_TOO_MANY_PAR        28
  39. #define RGERR_NULL_IN_PAR        29
  40. #define RGERR_UNMATCHED            30
  41. #define RGERR_NULL_IN_CRO        31
  42. #define RGERR_CYCLICAL_REF        32
  43. #define RGERR_UNDETERM_REF        33
  44. #define RGERR_UNMATCHED_PAR        34
  45.  
  46. #define    MATCH        0
  47. #define    MISMATCH    1
  48. #define    EXACTMATCH    2
  49. #define    MAXSYM        256    /* Size of the alphabet (in chars) */
  50. #define    WORD_SIZE    1024    /* (in bits) */
  51. #define MAXTAG        10
  52.  
  53. #include    <bitlist.h>
  54.  
  55. typedef struct tagAGrepInfo {
  56.     int    iErrorCode;
  57.     char    cPat[WORD_SIZE];
  58.     LPSTR    TagStart[MAXTAG];
  59.     LPSTR    TagEnd[MAXTAG];
  60.     int    bMatchCase;
  61.     BLIST    uMask;        /* internal structures */
  62.     BLIST    uOvMask;
  63.     BLIST    uLimit;
  64.     BLIST    blState;    /* temporary AGrep() structures */
  65.     BLIST    blOverflow;
  66.     BLIST    blTemp;
  67.     BLIST    uTable[MAXSYM];    /* characteristic vector table */
  68.     int    iBitsPerState;
  69.     int    iWordSize;    /* actual word size of BLIST's */
  70.     int    iType;        /* MATCH or MISMATCH */
  71.     char    cUPat[WORD_SIZE];
  72. } AGREPINFO;
  73. #ifdef    WINVER
  74. typedef    AGREPINFO*    PAGREPINFO;
  75. typedef    AGREPINFO FAR*    LPAGREPINFO;
  76. #else
  77. typedef    AGREPINFO*    PAGREPINFO;
  78. typedef    AGREPINFO*    LPAGREPINFO;
  79. #endif
  80.  
  81.  
  82. int    YGCALL    CompileAGrep( LPCSTR GrepString, int k, BOOL bMatchCase, LPAGREPINFO pGI );
  83. int    YGCALL    AGrep( LPCSTR StringToSearch, LPAGREPINFO pGI );
  84. int    YGCALL    AGrepInit( LPAGREPINFO pGI );
  85. int    YGCALL    AGrepEmpty( LPAGREPINFO pGI );
  86. int    YGCALL    AGrepSubsBuild( LPSTR lpszPattern, LPSTR lpszDest, int iSize, LPAGREPINFO pGI );
  87.  
  88.  
  89.  
  90. #define    MAXDFA    2*WORD_SIZE
  91.  
  92. #define CHRBIT    8
  93. #define BITBLK    MAXSYM/CHRBIT
  94.  
  95. typedef struct tagRGrepInfo {
  96.     int    iErrorCode;
  97.     char    cPat[WORD_SIZE];
  98.     LPSTR    TagStart[MAXTAG];
  99.     LPSTR    TagEnd[MAXTAG];
  100.     int    bMatchCase;
  101.     int    iCircf;        /* internal structures */
  102.     char    cDFA[MAXDFA];
  103. } RGREPINFO;
  104. #ifdef    WINVER
  105. typedef    RGREPINFO*    PRGREPINFO;
  106. typedef    RGREPINFO FAR*    LPRGREPINFO;
  107. #else
  108. typedef    RGREPINFO*    PRGREPINFO;
  109. typedef    RGREPINFO*    LPRGREPINFO;
  110. #endif
  111.  
  112. int    YGCALL    CompileRGrep( LPCSTR GrepString, BOOL bMatchCase, LPRGREPINFO pGI );
  113. int    YGCALL    RGrep( LPCSTR StringToSearch, LPRGREPINFO pGI );
  114. int    YGCALL    RGrepSubsBuild( LPSTR lpszPattern, LPSTR lpszDest, int iSize, LPRGREPINFO pGI) ;
  115. void    YGCALL    InitWordCharTable( void );
  116. void    YGCALL    AddWordChar( LPSTR s );
  117. void    YGCALL    RemoveWordChar( LPSTR s );
  118.  
  119.  
  120.  
  121. typedef    struct tagYGrepInfo {
  122.     union {
  123.         AGREPINFO    aGI;
  124.         RGREPINFO    rGI;
  125.     } y;
  126.     int    iTypeofINFO;    /* 0: empty, 1:AGREP, 2:RGREP */
  127. } YGREPINFO;
  128.  
  129.  
  130.  
  131. /* This part of the file is not yet implemented */
  132.  
  133. #ifdef    WINVER
  134. #define    YGREPMSGSTRING    "ygrep_Find"
  135.  
  136. typedef struct tagAGREPREPLACE
  137. {
  138.     DWORD    lStructSize;    /* size of this struct 0x?? */
  139.     HWND    hwndOwner;    /* handle to owner's window */
  140.     HINSTANCE    hInstance;    /* instance handle of.EXE that  */
  141.                 /* contains cust. dlg. template */
  142.     DWORD    Flags;        /* one or more of the FR_?? */
  143.     LPSTR    lpstrFindWhat;    /* ptr. to search string    */
  144.     LPSTR    lpstrReplaceWith;/* ptr. to replace string  */
  145.     UINT    wFindWhatLen;    /* size of find buffer      */
  146.     UINT    wReplaceWithLen;/* size of replace buffer   */
  147.     LPARAM    lCustData;    /* data passed to hook fn.  */
  148.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  149.                 /* ptr. to hook fn. or NULL */
  150.     LPCSTR    lpTemplateName;    /* custom template name     */
  151. } AGREPREPLACE;
  152. typedef AGREPREPLACE*        PAGREPREPLACE;
  153. typedef AGREPREPLACE FAR*    LPAGREPREPLACE;
  154.  
  155. #define AG_DOWN             0x00000001
  156. #define AG_WHOLEWORD            0x00000002
  157. #define AG_MATCHCASE            0x00000004
  158. #define AG_FINDNEXT            0x00000008
  159. #define AG_REPLACE            0x00000010
  160. #define AG_REPLACEALL            0x00000020
  161. #define AG_DIALOGTERM            0x00000040
  162. #define AG_SHOWHELP            0x00000080
  163. #define AG_ENABLEHOOK            0x00000100
  164. #define AG_ENABLETEMPLATE        0x00000200
  165. #define AG_NOUPDOWN            0x00000400
  166. #define AG_NOMATCHCASE            0x00000800
  167. #define AG_NOWHOLEWORD            0x00001000
  168. #define AG_ENABLETEMPLATEHANDLE     0x00002000
  169. #define AG_HIDEUPDOWN            0x00004000
  170. #define AG_HIDEMATCHCASE        0x00008000
  171. #define AG_HIDEWHOLEWORD        0x00010000
  172.  
  173. HWND    WINAPI GrepFindText(LPAGREPREPLACE);
  174. HWND    WINAPI GrepReplaceText(LPAGREPREPLACE);
  175. #endif    /*WINVER*/
  176.  
  177.  
  178.  
  179. #ifdef __cplusplus
  180. } /* extern "C" */
  181. #endif
  182. #endif    /* __YGREP_H__ */
  183.